#include "slist.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void my_printf(void *data)
{
    printf("%d ", *(int *)data);
    return;
}

int main(int argc, char **argv)
{
    slist_t *s = NULL;
    int num = 0;

    // 创建头信息结构体
    slist_create(&s, sizeof(int), my_destroy);

    while (1)
    {
    op:
        my_scanf(op, "%d", &num);

        if (num == -1)
        {
            break;
        }

        // 链表的插入
        slist_append(s, &num);
    }

    // 链表的遍历
    slist_traverse(s, my_printf);

    // 链表的销毁
    s->my_destroy(s);

    return 0;
}